import request from '@/common/request';
import config from '@/common/config';
import { encode } from '@/common/utils';

export async function login({ username, password }) {
  const result = await request({
    url: `${config.server}/user/login`,
    method: 'post',
    data: {
      username: encode(username),
      password: encode(password),
    },
  });
  return result;
}

export async function regist({ username, password }) {
  console.log(username, password);
  const result = await request({
    url: `${config.server}/user/register`,
    method: 'post',
    data: {
      username: encode(username),
      password: encode(password),
    },
  });
  return result;
}
